Full source code website bán hàng thương mại điện tử gần giống shopee
468.815 lượt xem;
1 <link type="text/css" href="css/jquery.datepick.css" rel="stylesheet">
2 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
3 <script type="text/javascript" src="css/jquery.datepick.js"></script>
4 <script type="text/javascript">
5 $(function() {
6 $('#popupDatepicker').datepick();
7 $('#inlineDatepicker').datepick({onSelect: showDate});
8 $('#popupDatepicker1').datepick();
9 $('#inlineDatepicker').datepick({onSelect: showDate});
10 });
11
12 function showDate(date) {
13 alert('The date chosen is ' + date);
14 }
15 </script>
16 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
17 <tr><td width="45%" height="20" align="center" class="title">
18 Danh sách SHOP | <a href="?act=users_add"><font color="#ffffff">Thên User</font></a>
19 </td></tr>
20 <tr><td>
21 <?
22 switch ($_GET['action'])
23 {
24 case 'del' :
25 $id = $_GET['id'];
26 $sql1="select * from user_shop where id=$id limit 1";
27 $pro=mysql_fetch_assoc(mysql_query($sql1,$con));
28
29 $sql2="select * from products where user='".$pro['user']."' ";
30 $pro2=mysql_fetch_assoc(mysql_query($sql2,$con));
31
32 $sql3="select * from slider_show where user='".$pro['user']."' ";
33 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
34
35 $sql4="select * from ads_mem where user='".$pro['user']."' ";
36 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
37
38 $sql5="select * from cat_mem where user='".$pro['user']."' ";
39 $pro5=mysql_fetch_assoc(mysql_query($sql5,$con));
40
41 $sql = "delete from user_shop where id='".$id."'";
42 @$result = mysql_query($sql,$con);
43 if ($result)
44 {
45 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
46 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
47 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
48
49 mysql_query("delete from products where user='".$pro['user']."'",$con);
50 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
51 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
52 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
53 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
54 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
55 mysql_query("delete from contact where user='".$pro['user']."'",$con);
56 mysql_query("delete from support_mem where user='".$pro['user']."'",$con);
57
58 if (file_exists("../".$pro2['image'])) unlink("../".$pro2['image']);
59 if (file_exists("../".$pro2['image_large'])) unlink("../".$pro2['image_large']);
60
61 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
62
63 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
64 echo "<p align=center class='err'>Đã xóa thành công </p>".$pro['user'];
65 }
66 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
67 break;
68 }
69 ?>
70
71 <?
72 if (isset($_POST['ButDel'])) {
73 $cnt=0;
74 foreach ($_POST['chk'] as $id)
75 {
76 $sql="select * from user_shop where id=$id limit 1";
77 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
78
79 $sql3="select * from slider_show where user='".$pro['user']."' ";
80 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
81 $sql4="select * from ads_mem where user='".$pro['user']."' ";
82 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
83 @$result = mysql_query("delete from user_shop where id='".$id."'",$con);
84 if ($result)
85 {
86 $cnt++;
87 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
88 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
89 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
90
91 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
92 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
93 mysql_query("delete from products where user='".$pro['user']."'",$con);
94 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
95 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
96 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
97 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
98 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
99 mysql_query("delete from contact where user='".$pro['user']."'",$con);
100 }
101 }
102 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
103 }
104 ?>
105 <?
106 if (isset($_POST['pay'])) {
107 $cnt=0;
108 foreach ($_POST['chk'] as $id)
109 {
110 $sql="select * from user_shop where id=$id limit 1";
111 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
112 @$result = mysql_query("update user_shop set active=1,hoahong_time='".strtotime(str_replace("/","-",date("d/m/Y")))."' where id='".$id."' and active=0 and level_shop=0",$con);
113 if ($result)
114 {
115 $cnt++;
116 }
117 }
118 echo "<p align=center class='err'>Đã thanh toán hoa hồng với ".$cnt." thành viên</p>";
119 }
120 ?>
121 <?
122 $page = $_GET["page"];
123 $MAXPAGE=50;
124 $p=0;
125 if ($page!='') $p=$page;
126 ?>
127 <input type=hidden name="page" value="<? echo $page; ?>">
128 <?
129 function taotrang($sql,$link,$nitem,$itemcurrent)
130 { global $con;
131 $ret="";
132 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
133 $value = mysql_fetch_array($result);
134 $plus = (($value['cnt'] % $nitem)>0);
135 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
136 {
137 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
138 else $ret .= ($i+1)." ";
139 }
140 return $ret;
141 }
142 $pageindex=taotrang("select count(*) from user_shop","./?act=users"."&page=",$MAXPAGE,$page);
143 ?>
144
145 <table cellspacing="0" cellpadding="0">
146 <tr>
147 <td>Trang : <? echo $pageindex; ?></td>
148 </tr>
149 </table>
150 <table cellspacing="0" cellpadding="0">
151 <tr>
152
153 <td>
154 <!-- begin tim kiem-->
155 <form name="form_select" method="GET" action="./">
156 <input type="hidden" name="act" value="users" />
157 <input type="hidden" name="search" value="search" />
158 <table id="timkiem_home" border="0" id="table21" cellspacing="0" cellpadding="0">
159 <tr>
160 <td>
161 Tên Shop: <input value="<? echo ($_REQUEST['keywords']) ?>" name="keywords" type="text" id="input_timkiem" value="">
162 </td>
163
164 <td style="padding-left:10px;padding-right:10px;">
165 <select name="level" style=" height: 22px; ">
166 <option value="">-- Chọn tất cả --</option>
167 <?php if($_REQUEST['level']=='0')
168 {?>
169 <option value="0" selected>Shop Lửa Đỏ</option>
170 <option value="3">Shop bình thường</option>
171 <?}elseif($_REQUEST['level']=='3'){?>
172 <option value="0">Shop Lửa Đỏ</option>
173 <option value="3" selected>Shop bình thường</option>
174 <?}else{?>
175 <option value="0">Shop Lửa Đỏ</option>
176 <option value="3">Shop bình thường</option>
177 <?}?>
178 </select>
179 </td>
180
181 <td colspan="5" style=" text-align:center">
182 <a href="/admin/?act=users"><input type="button" class="button" value="Bỏ lọc" /></a>
183 <input type="submit" class="button" name="timkiem" value="Tìm kiếm" />
184 </td>
185 </tr></table>
186 <table>
187
188 </tr>
189
190 </tr>
191 </table>
192 </form>
193 <!-- end tim kiem -->
194 </td>
195 </tr>
196 </table>
197
198
199 <tr><td>
200 <!-- begin danh sach -->
201 <form method="POST" action="" name="frmList">
202 <table border="1" cellpadding="2" style="border-collapse: collapse;font-size:12px" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
203 <tr class="title">
204 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
205 <td><center>Chức năng</td>
206 <td>ID</td>
207 <td>User</td>
208 <td>Thông tin</td>
209 <td>Ngân sách</td>
210
211
212 </tr>
213 <?php if($_REQUEST['search']=='')
214 {?>
215 <?
216 if($_REQUEST['by']=='')
217 {
218 $by="id";
219 }
220 else
221 {
222 $by=$_REQUEST['by'];
223 }
224 if($_REQUEST['order']=='')
225 {
226 $order="desc";
227 }
228 else
229 {
230 $order=$_REQUEST['order'];
231 }
232 $sql=mysql_query("SELECT * FROM user_shop order by ".$by." ".$order." limit ".($p*$MAXPAGE).",".$MAXPAGE);
233 $i=0;
234 while($row=mysql_fetch_array($sql))
235 {
236 $i++;
237 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
238 $chietkhau=$chietkhau+$row['chietkhau'];
239 $chietkhau1=0;
240 $tien=$tien+$row['tien'];
241 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
242 $row_reg=mysql_fetch_assoc($sql_reg);
243 $sql_reg1=mysql_query("SELECT * FROM user_shop where user='".$row['user']."' ");
244 $row_reg1=mysql_fetch_assoc($sql_reg1);
245 $sql_city=mysql_query("SELECT * FROM city where id='".$row['city']."' ");
246 $row_city=mysql_fetch_assoc($sql_city);
247 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
248 while($row_ck=mysql_fetch_array($sql_ck))
249 {
250 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
251 }
252 ?>
253
254 <tr bgcolor="<? echo $color;?>" class="table_a">
255 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
256 <td width="20">
257 <center><INPUT type="button" value="Sửa" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
258
259
260
261 <td><? echo $row['id'];?></td>
262 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
263 <td>
264 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">ID Shop: </td><td style=\"width:400px\"><? echo $row_reg1['id'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tên Shop: </td><td style=\"width:400px\"><? echo $row_reg1['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Loại Shop: </td><td style=\"width:400px\"><?php if($row_reg1['level_shop'] == '0'){?><b style=\"color:red\">Shop Lửa Đỏ </b><?}else{?>Shop Thường<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tỉnh/TP: </td><td style=\"width:400px\"><? echo $row_city['name'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tình trạng: </td><td style=\"width:400px\"><?php if($row_reg1['active'] == '0'){?><b style=\"color:blue\">Kích hoạt </b><?}else{?>Bị Khóa<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg1['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Điện thoại: </td><td><? echo $row_reg1['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:110px;height:20px;text-align:right\">Ngày đăng ký: </td><td><? echo $row_reg1['re_time'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Địa chỉ: </td><td><? echo $row['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['user']; ?>" target="_blank">
265 <font color="blue">Xem Shop</b></font>
266 </a>
267 </td>
268
269
270 <td><? echo number_format($row['tien'],0);?></td>
271
272 </tr>
273 <?}?>
274
275 </table>
276 <!-- end danh sach -->
277
278
279
280 </td></tr>
281 </table>
282 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
283 </form>
284 <?}else{?>
285 <?
286 $where="1=1";
287 $keywords=killInjection($_REQUEST['keywords']);
288 if ($keywords!='')
289 {
290 $where.=" and (mieuta like '%".$keywords."%' or title like '%".$keywords."%'";
291 if ($_REQUEST['search_in_description']=='')
292 $where.="or user like '%".$keywords."%' or company like '%".$keywords."%' or address like '%".$keywords."%' ";
293 $where.=") ";
294 }
295 if ($_REQUEST['cat_id']!='') $where.=" and cat_mem=".$_REQUEST['cat_id'];
296 if ($_REQUEST['level']!='') $where.=" and level_shop=".$_REQUEST['level'];
297 if ($_REQUEST['active']!='') $where.=" and active=".$_REQUEST['active'];
298 if ($_REQUEST['date']!='') $where.=" and re_time>=".strtotime(str_replace("/","-",$_REQUEST['date']));
299 if ($_REQUEST['date2']!='') $where.=" and re_time<=".strtotime(str_replace("/","-",$_REQUEST['date2']));
300
301 $MAXPAGE=50;
302 $p=0;
303 if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
304 if ($_REQUEST['nhom']=='')
305 {
306 $nhom="";
307 }
308 else
309 {
310 $nhom="and reg_user='".$_REQUEST['nhom']."'";
311 }
312 $sql="select * from user_shop where $where $nhom limit ".$p*$MAXPAGE.",".$MAXPAGE;
313 $result = mysql_query($sql,$con);
314 $tien=0;
315 $chietkhau=0;
316 $i=0;
317 while (($row=mysql_fetch_assoc($result)))
318 {
319 $i++;
320 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
321 $tien=$tien+$row['tien'];
322 $chietkhau=$chietkhau+$row['chietkhau'];
323 $chietkhau1=0;
324 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
325 $row_reg=mysql_fetch_assoc($sql_reg);
326 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
327 while($row_ck=mysql_fetch_array($sql_ck))
328 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
329 $row_reg=mysql_fetch_assoc($sql_reg);
330 $sql_reg1=mysql_query("SELECT * FROM user_shop where user='".$row['user']."' ");
331 $row_reg1=mysql_fetch_assoc($sql_reg1);
332 $sql_city=mysql_query("SELECT * FROM city where id='".$row['city']."' ");
333 $row_city=mysql_fetch_assoc($sql_city);
334 {
335 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
336 }
337 ?>
338 <tr bgcolor="<? echo $color;?>" class="table_a">
339 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
340 <td width="20">
341 <center><INPUT type="button" value="Sửa" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
342
343
344
345
346 <td><? echo $row['id'];?></td>
347 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
348 <td>
349 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">ID Shop: </td><td style=\"width:400px\"><? echo $row_reg1['id'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tên Shop: </td><td style=\"width:400px\"><? echo $row_reg1['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Loại Shop: </td><td style=\"width:400px\"><?php if($row_reg1['level_shop'] == '0'){?><b style=\"color:red\">Shop Lửa Đỏ </b><?}else{?>Shop Thường<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tỉnh/TP: </td><td style=\"width:400px\"><? echo $row_city['name'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tình trạng: </td><td style=\"width:400px\"><?php if($row_reg1['active'] == '0'){?><b style=\"color:blue\">Kích hoạt </b><?}else{?>Bị Khóa<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg1['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Điện thoại: </td><td><? echo $row_reg1['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:110px;height:20px;text-align:right\">Ngày đăng ký: </td><td><? echo $row_reg1['re_time'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Địa chỉ: </td><td><? echo $row['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['user']; ?>" target="_blank">
350 <font color="blue">Xem Shop</b></font>
351 </a>
352 </td>
353
354
355 <td><? echo number_format($row['tien'],0);?></td>
356
357 </tr>
358 <?}
359 settype($total[0],int);
360 ?>
361
362 </table>
363 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
364 <tr><td colspan="2" height="7"></td></tr>
365 <tr>
366 <td>
367 </td>
368
369
370
371 <td align="right">
372 </td>
373
374
375 </tr>
376 </table>
377 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
378
379 </form>
380 <?}?>
381 <script language="JavaScript">
382 function chkallClick(o) {
383 var form = document.frmList;
384 for (var i = 0; i < form.elements.length; i++) {
385 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
386 form.elements[i].checked = document.frmList.chkall.checked;
387 }
388 }
389 }
390 </script>
2 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
3 <script type="text/javascript" src="css/jquery.datepick.js"></script>
4 <script type="text/javascript">
5 $(function() {
6 $('#popupDatepicker').datepick();
7 $('#inlineDatepicker').datepick({onSelect: showDate});
8 $('#popupDatepicker1').datepick();
9 $('#inlineDatepicker').datepick({onSelect: showDate});
10 });
11
12 function showDate(date) {
13 alert('The date chosen is ' + date);
14 }
15 </script>
16 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
17 <tr><td width="45%" height="20" align="center" class="title">
18 Danh sách SHOP | <a href="?act=users_add"><font color="#ffffff">Thên User</font></a>
19 </td></tr>
20 <tr><td>
21 <?
22 switch ($_GET['action'])
23 {
24 case 'del' :
25 $id = $_GET['id'];
26 $sql1="select * from user_shop where id=$id limit 1";
27 $pro=mysql_fetch_assoc(mysql_query($sql1,$con));
28
29 $sql2="select * from products where user='".$pro['user']."' ";
30 $pro2=mysql_fetch_assoc(mysql_query($sql2,$con));
31
32 $sql3="select * from slider_show where user='".$pro['user']."' ";
33 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
34
35 $sql4="select * from ads_mem where user='".$pro['user']."' ";
36 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
37
38 $sql5="select * from cat_mem where user='".$pro['user']."' ";
39 $pro5=mysql_fetch_assoc(mysql_query($sql5,$con));
40
41 $sql = "delete from user_shop where id='".$id."'";
42 @$result = mysql_query($sql,$con);
43 if ($result)
44 {
45 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
46 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
47 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
48
49 mysql_query("delete from products where user='".$pro['user']."'",$con);
50 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
51 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
52 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
53 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
54 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
55 mysql_query("delete from contact where user='".$pro['user']."'",$con);
56 mysql_query("delete from support_mem where user='".$pro['user']."'",$con);
57
58 if (file_exists("../".$pro2['image'])) unlink("../".$pro2['image']);
59 if (file_exists("../".$pro2['image_large'])) unlink("../".$pro2['image_large']);
60
61 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
62
63 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
64 echo "<p align=center class='err'>Đã xóa thành công </p>".$pro['user'];
65 }
66 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
67 break;
68 }
69 ?>
70
71 <?
72 if (isset($_POST['ButDel'])) {
73 $cnt=0;
74 foreach ($_POST['chk'] as $id)
75 {
76 $sql="select * from user_shop where id=$id limit 1";
77 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
78
79 $sql3="select * from slider_show where user='".$pro['user']."' ";
80 $pro3=mysql_fetch_assoc(mysql_query($sql3,$con));
81 $sql4="select * from ads_mem where user='".$pro['user']."' ";
82 $pro4=mysql_fetch_assoc(mysql_query($sql4,$con));
83 @$result = mysql_query("delete from user_shop where id='".$id."'",$con);
84 if ($result)
85 {
86 $cnt++;
87 if (file_exists("../".$pro['logo'])) unlink("../".$pro['logo']);
88 if (file_exists("../".$pro['banner'])) unlink("../".$pro['banner']);
89 if (file_exists("../".$pro['background'])) unlink("../".$pro['background']);
90
91 if (file_exists("../".$pro3['image'])) unlink("../".$pro3['image']);
92 if (file_exists("../".$pro4['image'])) unlink("../".$pro4['image']);
93 mysql_query("delete from products where user='".$pro['user']."'",$con);
94 mysql_query("delete from slider_show where user='".$pro['user']."'",$con);
95 mysql_query("delete from ads_mem where user='".$pro['user']."'",$con);
96 mysql_query("delete from cat_mem where user='".$pro['user']."'",$con);
97 mysql_query("delete from orders where orders_user='".$pro['user']."'",$con);
98 mysql_query("delete from orderdetail where user='".$pro['user']."'",$con);
99 mysql_query("delete from contact where user='".$pro['user']."'",$con);
100 }
101 }
102 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
103 }
104 ?>
105 <?
106 if (isset($_POST['pay'])) {
107 $cnt=0;
108 foreach ($_POST['chk'] as $id)
109 {
110 $sql="select * from user_shop where id=$id limit 1";
111 $pro=mysql_fetch_assoc(mysql_query($sql,$con));
112 @$result = mysql_query("update user_shop set active=1,hoahong_time='".strtotime(str_replace("/","-",date("d/m/Y")))."' where id='".$id."' and active=0 and level_shop=0",$con);
113 if ($result)
114 {
115 $cnt++;
116 }
117 }
118 echo "<p align=center class='err'>Đã thanh toán hoa hồng với ".$cnt." thành viên</p>";
119 }
120 ?>
121 <?
122 $page = $_GET["page"];
123 $MAXPAGE=50;
124 $p=0;
125 if ($page!='') $p=$page;
126 ?>
127 <input type=hidden name="page" value="<? echo $page; ?>">
128 <?
129 function taotrang($sql,$link,$nitem,$itemcurrent)
130 { global $con;
131 $ret="";
132 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
133 $value = mysql_fetch_array($result);
134 $plus = (($value['cnt'] % $nitem)>0);
135 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
136 {
137 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
138 else $ret .= ($i+1)." ";
139 }
140 return $ret;
141 }
142 $pageindex=taotrang("select count(*) from user_shop","./?act=users"."&page=",$MAXPAGE,$page);
143 ?>
144
145 <table cellspacing="0" cellpadding="0">
146 <tr>
147 <td>Trang : <? echo $pageindex; ?></td>
148 </tr>
149 </table>
150 <table cellspacing="0" cellpadding="0">
151 <tr>
152
153 <td>
154 <!-- begin tim kiem-->
155 <form name="form_select" method="GET" action="./">
156 <input type="hidden" name="act" value="users" />
157 <input type="hidden" name="search" value="search" />
158 <table id="timkiem_home" border="0" id="table21" cellspacing="0" cellpadding="0">
159 <tr>
160 <td>
161 Tên Shop: <input value="<? echo ($_REQUEST['keywords']) ?>" name="keywords" type="text" id="input_timkiem" value="">
162 </td>
163
164 <td style="padding-left:10px;padding-right:10px;">
165 <select name="level" style=" height: 22px; ">
166 <option value="">-- Chọn tất cả --</option>
167 <?php if($_REQUEST['level']=='0')
168 {?>
169 <option value="0" selected>Shop Lửa Đỏ</option>
170 <option value="3">Shop bình thường</option>
171 <?}elseif($_REQUEST['level']=='3'){?>
172 <option value="0">Shop Lửa Đỏ</option>
173 <option value="3" selected>Shop bình thường</option>
174 <?}else{?>
175 <option value="0">Shop Lửa Đỏ</option>
176 <option value="3">Shop bình thường</option>
177 <?}?>
178 </select>
179 </td>
180
181 <td colspan="5" style=" text-align:center">
182 <a href="/admin/?act=users"><input type="button" class="button" value="Bỏ lọc" /></a>
183 <input type="submit" class="button" name="timkiem" value="Tìm kiếm" />
184 </td>
185 </tr></table>
186 <table>
187
188 </tr>
189
190 </tr>
191 </table>
192 </form>
193 <!-- end tim kiem -->
194 </td>
195 </tr>
196 </table>
197
198
199 <tr><td>
200 <!-- begin danh sach -->
201 <form method="POST" action="" name="frmList">
202 <table border="1" cellpadding="2" style="border-collapse: collapse;font-size:12px" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
203 <tr class="title">
204 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
205 <td><center>Chức năng</td>
206 <td>ID</td>
207 <td>User</td>
208 <td>Thông tin</td>
209 <td>Ngân sách</td>
210
211
212 </tr>
213 <?php if($_REQUEST['search']=='')
214 {?>
215 <?
216 if($_REQUEST['by']=='')
217 {
218 $by="id";
219 }
220 else
221 {
222 $by=$_REQUEST['by'];
223 }
224 if($_REQUEST['order']=='')
225 {
226 $order="desc";
227 }
228 else
229 {
230 $order=$_REQUEST['order'];
231 }
232 $sql=mysql_query("SELECT * FROM user_shop order by ".$by." ".$order." limit ".($p*$MAXPAGE).",".$MAXPAGE);
233 $i=0;
234 while($row=mysql_fetch_array($sql))
235 {
236 $i++;
237 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
238 $chietkhau=$chietkhau+$row['chietkhau'];
239 $chietkhau1=0;
240 $tien=$tien+$row['tien'];
241 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
242 $row_reg=mysql_fetch_assoc($sql_reg);
243 $sql_reg1=mysql_query("SELECT * FROM user_shop where user='".$row['user']."' ");
244 $row_reg1=mysql_fetch_assoc($sql_reg1);
245 $sql_city=mysql_query("SELECT * FROM city where id='".$row['city']."' ");
246 $row_city=mysql_fetch_assoc($sql_city);
247 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
248 while($row_ck=mysql_fetch_array($sql_ck))
249 {
250 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
251 }
252 ?>
253
254 <tr bgcolor="<? echo $color;?>" class="table_a">
255 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
256 <td width="20">
257 <center><INPUT type="button" value="Sửa" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
258
259
260
261 <td><? echo $row['id'];?></td>
262 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
263 <td>
264 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">ID Shop: </td><td style=\"width:400px\"><? echo $row_reg1['id'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tên Shop: </td><td style=\"width:400px\"><? echo $row_reg1['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Loại Shop: </td><td style=\"width:400px\"><?php if($row_reg1['level_shop'] == '0'){?><b style=\"color:red\">Shop Lửa Đỏ </b><?}else{?>Shop Thường<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tỉnh/TP: </td><td style=\"width:400px\"><? echo $row_city['name'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tình trạng: </td><td style=\"width:400px\"><?php if($row_reg1['active'] == '0'){?><b style=\"color:blue\">Kích hoạt </b><?}else{?>Bị Khóa<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg1['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Điện thoại: </td><td><? echo $row_reg1['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:110px;height:20px;text-align:right\">Ngày đăng ký: </td><td><? echo $row_reg1['re_time'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Địa chỉ: </td><td><? echo $row['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['user']; ?>" target="_blank">
265 <font color="blue">Xem Shop</b></font>
266 </a>
267 </td>
268
269
270 <td><? echo number_format($row['tien'],0);?></td>
271
272 </tr>
273 <?}?>
274
275 </table>
276 <!-- end danh sach -->
277
278
279
280 </td></tr>
281 </table>
282 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
283 </form>
284 <?}else{?>
285 <?
286 $where="1=1";
287 $keywords=killInjection($_REQUEST['keywords']);
288 if ($keywords!='')
289 {
290 $where.=" and (mieuta like '%".$keywords."%' or title like '%".$keywords."%'";
291 if ($_REQUEST['search_in_description']=='')
292 $where.="or user like '%".$keywords."%' or company like '%".$keywords."%' or address like '%".$keywords."%' ";
293 $where.=") ";
294 }
295 if ($_REQUEST['cat_id']!='') $where.=" and cat_mem=".$_REQUEST['cat_id'];
296 if ($_REQUEST['level']!='') $where.=" and level_shop=".$_REQUEST['level'];
297 if ($_REQUEST['active']!='') $where.=" and active=".$_REQUEST['active'];
298 if ($_REQUEST['date']!='') $where.=" and re_time>=".strtotime(str_replace("/","-",$_REQUEST['date']));
299 if ($_REQUEST['date2']!='') $where.=" and re_time<=".strtotime(str_replace("/","-",$_REQUEST['date2']));
300
301 $MAXPAGE=50;
302 $p=0;
303 if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
304 if ($_REQUEST['nhom']=='')
305 {
306 $nhom="";
307 }
308 else
309 {
310 $nhom="and reg_user='".$_REQUEST['nhom']."'";
311 }
312 $sql="select * from user_shop where $where $nhom limit ".$p*$MAXPAGE.",".$MAXPAGE;
313 $result = mysql_query($sql,$con);
314 $tien=0;
315 $chietkhau=0;
316 $i=0;
317 while (($row=mysql_fetch_assoc($result)))
318 {
319 $i++;
320 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
321 $tien=$tien+$row['tien'];
322 $chietkhau=$chietkhau+$row['chietkhau'];
323 $chietkhau1=0;
324 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
325 $row_reg=mysql_fetch_assoc($sql_reg);
326 $sql_ck=mysql_query("SELECT * FROM user_shop where reg_user='".$row['user']."'");
327 while($row_ck=mysql_fetch_array($sql_ck))
328 $sql_reg=mysql_query("SELECT * FROM user_shop where reg_user='".$row['reg_user']."' ");
329 $row_reg=mysql_fetch_assoc($sql_reg);
330 $sql_reg1=mysql_query("SELECT * FROM user_shop where user='".$row['user']."' ");
331 $row_reg1=mysql_fetch_assoc($sql_reg1);
332 $sql_city=mysql_query("SELECT * FROM city where id='".$row['city']."' ");
333 $row_city=mysql_fetch_assoc($sql_city);
334 {
335 $chietkhau1=$chietkhau1+$row_ck['chietkhau'];
336 }
337 ?>
338 <tr bgcolor="<? echo $color;?>" class="table_a">
339 <td width="20" align="center"><input type="checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
340 <td width="20">
341 <center><INPUT type="button" value="Sửa" onClick="window.open('./user_profile.php?id=<? echo $row['id']; ?>','mywindow','width=860,height=400')"> </td>
342
343
344
345
346 <td><? echo $row['id'];?></td>
347 <td><a href="../<? echo $row['user']; ?>" target="_blank"><? echo $row['user']; ?></a></td>
348 <td>
349 <a onmouseover='showtip("<div><table style=\"padding:10px;background-color:black;color:white\"><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">ID Shop: </td><td style=\"width:400px\"><? echo $row_reg1['id'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tên Shop: </td><td style=\"width:400px\"><? echo $row_reg1['company'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Loại Shop: </td><td style=\"width:400px\"><?php if($row_reg1['level_shop'] == '0'){?><b style=\"color:red\">Shop Lửa Đỏ </b><?}else{?>Shop Thường<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tỉnh/TP: </td><td style=\"width:400px\"><? echo $row_city['name'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Tình trạng: </td><td style=\"width:400px\"><?php if($row_reg1['active'] == '0'){?><b style=\"color:blue\">Kích hoạt </b><?}else{?>Bị Khóa<?}?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Email: </td><td><? echo $row_reg1['email'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Điện thoại: </td><td><? echo $row_reg1['phone'];?></td></tr><tr><td style=\"padding-right:10px;width:110px;height:20px;text-align:right\">Ngày đăng ký: </td><td><? echo $row_reg1['re_time'];?></td></tr><tr><td style=\"padding-right:10px;width:100px;height:20px;text-align:right\">Địa chỉ: </td><td><? echo $row['address'];?></td></tr></table></div>");' onmouseout="hidetip();" href="../<? echo $row['user']; ?>" target="_blank">
350 <font color="blue">Xem Shop</b></font>
351 </a>
352 </td>
353
354
355 <td><? echo number_format($row['tien'],0);?></td>
356
357 </tr>
358 <?}
359 settype($total[0],int);
360 ?>
361
362 </table>
363 <table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
364 <tr><td colspan="2" height="7"></td></tr>
365 <tr>
366 <td>
367 </td>
368
369
370
371 <td align="right">
372 </td>
373
374
375 </tr>
376 </table>
377 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
378
379 </form>
380 <?}?>
381 <script language="JavaScript">
382 function chkallClick(o) {
383 var form = document.frmList;
384 for (var i = 0; i < form.elements.length; i++) {
385 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
386 form.elements[i].checked = document.frmList.chkall.checked;
387 }
388 }
389 }
390 </script>